<template>
  <div>
      <div class="container">
          <el-breadcrumb separator="/">
              <el-breadcrumb-item class="mb">
                  商户排名
              </el-breadcrumb-item>
          </el-breadcrumb>
          <el-table
              :data="tableData"
              border
              class="table"
              ref="multipleTable"
              header-cell-class-name="table-header"
          >
              <el-table-column prop="id" label="排名" align="center"></el-table-column>
              <el-table-column class="height" prop="name" label="商户名称" align="center"></el-table-column>
              <el-table-column prop="address" label="门店地址" align="center"></el-table-column>
              <el-table-column prop="date" label="负责人" align="center"></el-table-column>
              <el-table-column prop="date" label="平均星级" align="center">
                  <template slot-scope="scope">
                  </template>
              </el-table-column>
          </el-table>
          <div class="pagination">
              <el-pagination
                  background
                  layout="total, prev, pager, next"
                  :current-page="query.pageIndex"
                  :page-size="query.pageSize"
                  :total="pageTotal"
                  @current-change="handlePageChange"
              ></el-pagination>
          </div>
      </div>
  </div>
</template>

<script>
import { fetchData } from '../../../api/index';
export default {
  name: 'basetable',
  data() {
      return {
          query: {
              address: '',
              name: '',
              pageIndex: 1,
              pageSize: 10,
          },
          tableData: [],
          pageTotal: 0,
      };
  },
  created() {
      this.getData();
  },
  methods: {
      // 获取 easy-mock 的模拟数据
      getData() {
          fetchData(this.query).then(res => {
              console.log(res);
              this.tableData = res.list;
              this.pageTotal = res.pageTotal || 50;
          });
      },
      // 分页导航
      handlePageChange(val) {
          this.$set(this.query, 'pageIndex', val);
          this.getData();
      }
  }
};
</script>

<style scoped>
.handle-box {
  margin-bottom: 60px;
  background-color: rgb(245,245,245);
  padding: 20px 60px;
}
.mb{
  margin-bottom: 10px;
}

.handle-select {
  width: 120px;
}
>>>.el-table tbody tr{
  height: 100px;
}
.handle-input {
  width: 300px;
  display: inline-block;
}
.table {
  width: 100%;
  font-size: 14px;
}
.red {
  color: #ff0000;
}
.mr10 {
  margin-right: 40px;
}
.mt{
  margin-top: 20px;
}
.table-td-thumb {
  display: block;
  margin: auto;
  width: 40px;
  height: 40px;
}
</style>
